def print_info(**kwargs):
    for key, value in kwargs.items():
        print(f"{key}: {value}")


print_info(**{'name': "Alice", 'age': 25, 'city': "Guangzhou"})
print_info(name='Abbot', age=19, city='Guangzhou')


def sum_two(m, n):
    return m + n


result = sum_two(82, 92)
print(result)


# 求一个数平方的函数
def power(x, n=2):
    return x ** n


a = power(4)
b = power(8, 3)
c = power(5, 3)
print(a, b, c)
a = int('16', 8)  # 八进制的数以十进制的形式输出
print(a)


def infos(name, age=14, gender='女'):
    return "大家好，我叫%s,我今年%d岁，我是一名%s生" % (name, age, gender)


s = infos('quantization', 19, '男')
print(s)
Lily = infos('Lily')
print(Lily)
John = infos("john", gender='男')
print(John)


# 可变参数
def total(*args):
    print(args)
    result1 = 0
    for i in args:
        result1 += i * i
    return result1


result = total(23, 43, 54, 64, 5, 45, 3, 42, 32)
print(result)
list1 = [1, 2, 3, 4, 5]
print(total(*list1))
set1 = {1, 2, 3, 4, 5}
print(total(*set1))
tuple1 = (1, 2, 3, 4, 5)
print(total(*tuple1))


def f(**kwargs):  # 可变参数，接受字典
    for k, v in kwargs.items():
        print(k, v)


d = {'name': 'xiaoming', 'age': 18}
f(**d)
